extern inline unsigned char get_fs_byte(const char * addr)
{
	unsigned register char _v;

	__asm__ ("movb %%fs:%1,%0":"=r" (_v):"m" (*addr));
	return _v;
}

extern inline unsigned short get_fs_word(const unsigned short *addr)
{
	unsigned short _v;

	__asm__ ("movw %%fs:%1,%0":"=r" (_v):"m" (*addr));
	return _v;
}

// extern inline unsigned long get_fs_long(const unsigned long *addr)
// {
// 	unsigned long _v;

// 	__asm__ ("movl %%fs:%1,%0":"=r" (_v):"m" (*addr)); \
// 	return _v;
// }

extern inline unsigned long get_fs_long(const unsigned long *addr)
{
    unsigned long _v;//32bit or 64bit
	//用户内存数据复制到内核内存；
	//用到段寄存器fs，因为用户/内核内存起始坐标不同？
    __asm__ ("movl %%fs:%1,%0" //movl %%fs:m,r 
             : "=r" (_v)      /* 输出操作数 _v位于内核内存*/
             : "m" (*addr));  /* 输入操作数 *addr位于用户内存*/ 

    return _v;
}



extern inline void put_fs_byte(char val,char *addr)
{
__asm__ ("movb %0,%%fs:%1"::"r" (val),"m" (*addr));
}

extern inline void put_fs_word(short val,short * addr)
{
__asm__ ("movw %0,%%fs:%1"::"r" (val),"m" (*addr));
}

extern inline void put_fs_long(unsigned long val,unsigned long * addr)
{
__asm__ ("movl %0,%%fs:%1"::"r" (val),"m" (*addr));
}
